package com.wx.tgp.designpattern.StrategyPattern.Shoppingmall;

/**
 * 策略具体类，购物返利算法
 */
public class RebatePay implements Paymate{

    private double price;

    public RebatePay(double price){
        this.price = price;
    }

    public double shoppingPay() {
        double result;
        // 购物满300减100，每一个300都减去100
        if(price>=300){
            double num = Math.floor(price/300);
            result = price - num*100;
        }else{
            result = price;
        }
        return result;
    }
}
